#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <vector>
#include <map>
using namespace std;
int main() {
    int t;
    cin >> t;
    long long x, y;
    long long a, b, c, d, e, f;
    for (int i = 0; i < t; i++) {
        cin >> a >> b >> c >> d >> e >> f;
        bool flag1 = (a == 0 && b == 0);
        bool flag2 = (d == 0 && e == 0);
        if (flag1 && (c == 0) && flag2 && (f == 0)) {
            cout << "0.0" << endl;
        } else if ((flag1 && (c != 0)) ||(flag2 && f != 0)) {
            cout << "0v0" << endl;
        } else if (a * e == b * d && b * f == c * e)
            cout << "0.0" << endl;
        else if (b * d == a * e)
            cout << "0v0" << endl;
        else  {
                x = (c * e - b * f) / (a * e - b * d);
                y = (a * f - c * d) / (a * e - b * d);
            if(a*x+b*y==c and d*x+e*y==f)
            cout << x << " " << y << endl;
            else
            cout<<"0v0"<<endl;
        }
    }
    return 0;
}